using System;
using System.Xml;
using System.Xml.Serialization;
using rlTodayMakeSkin.Project.Attributes;

namespace rlTodayMakeSkin.Project.XmlElement.XmlSubElements
{
    public class rlFont : XmlSubElement
    {
        private string strName;
        private string strWeight;
        private int intSize;

        public rlFont(rlTodayXmlElement parent) : base(parent)
        {
            strName = "Arial";
            strWeight = "normal";
            intSize = 10;
        }

        public rlFont(XmlAttributeCollection lstAttr, rlTodayXmlElement parent) : base(parent)
        {
            if (lstAttr["font"] != null) strName = lstAttr["font"].Value; else strName = "Arial";
            if (lstAttr["size"] != null) intSize = int.Parse(lstAttr["size"].Value); else intSize = 10;
            if (lstAttr["weight"] != null) strWeight = lstAttr["weight"].Value; else strWeight = "normal";
        }

        /// <summary>
        /// for the serialization
        /// </summary>
        public rlFont() { } 

        /// <summary>
        /// Font name for this element
        /// </summary>
        [PropertyDescription("Gets, sets font name for this element.", PropertyTypes.FONT_NAME)]
        [XmlAttribute("font")]
        public string FontName { get { return strName; } set { strName = value; } }

        /// <summary>
        /// The weight for the text (normal or bold)
        /// </summary>
        [PropertyDescription("Gets, sets the weight for the text (normal or bold).", PropertyTypes.FONT_WEIGTH)]
        [XmlAttribute("weight")]
        public string Weight { get { return strWeight; } set { strWeight = value; } }

        /// <summary>
        /// Size of the text
        /// </summary>
        [PropertyDescription("Gets, sets the size of the text.", PropertyTypes.FONT_SIZE)]
        [XmlAttribute("size")]
        public int Size { get { return intSize; } set { intSize = value; } }

        /// <summary>
        /// This element is never empty
        /// </summary>
        /// <returns>false</returns>
        public override bool isEmpty()
        {
            return false;
        }


    }
}
